package edu.iscas.xcheck.analysis.model;

import edu.iscas.xcheck.analysis.dom.model.DomNode;

public class XbiIssue {
	private XBITYPE type;
	private ISSUETYPE issue;
	private XbiDomNode refNode;
	private XbiDomNode refParent;
	private XbiDomNode cmpNode;
	private XbiDomNode cmpParent;
	private String msg;
	
	public enum XBITYPE{
		Behavior, Layout
	}
	
	public enum ISSUETYPE{
		Missing, Different, Additional
	}
	
	public XbiIssue(XBITYPE type, ISSUETYPE issue, String msg){
		this.type = type;
		this.issue = issue;
		this.msg = msg;
	}
	public XBITYPE getType() {
		return type;
	}

	public void setType(XBITYPE type) {
		this.type = type;
	}

	public ISSUETYPE getIssue() {
		return issue;
	}

	public void setIssue(ISSUETYPE issue) {
		this.issue = issue;
	}

	public XbiDomNode getRefNode() {
		return refNode;
	}

	public void setRefNode(XbiDomNode refNode) {
		this.refNode = refNode;
	}
	
	public void setRefNode(DomNode node) {
		this.refNode = new XbiDomNode(node.getxPath(),node.getCoords());
	}
	
	public XbiDomNode getCmpNode() {
		return cmpNode;
	}

	public void setCmpNode(String xpath,int[] coord) {
		this.cmpNode = new XbiDomNode(xpath,coord);
	}
	public void setCmpNode(DomNode node) {
		this.cmpNode = new XbiDomNode(node.getxPath(),node.getCoords());
	}
	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public XbiDomNode getRefParent() {
		return refParent;
	}
	public void setRefParent(XbiDomNode refParent) {
		this.refParent = refParent;
	}

	public void setRefParent(DomNode node) {
		this.refParent = new XbiDomNode(node.getxPath(),node.getCoords());
	}
	
	public XbiDomNode getCmpParent() {
		return cmpParent;
	}
	public void setCmpParent(XbiDomNode cmpParent) {
		this.cmpParent = cmpParent;
	}
	public void setCmpParent(DomNode node) {
		this.cmpParent = new XbiDomNode(node.getxPath(),node.getCoords());
	}
	class XbiDomNode{
		private String xpath;
		private int[] coord;;
		public String getXpath() {
			return xpath;
		}
		public void setXpath(String xpath) {
			this.xpath = xpath;
		}
		public int[] getCoord() {
			return coord;
		}
		public void setCoord(int[] coord) {
			this.coord = coord;
		}
		public XbiDomNode(String xpath, int[] coord) {
			this.xpath = xpath;
			this.coord = coord;
		}
	}
}
